﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace IM.Manage.Models
{
    public class News : BaseModel
    {
        [Required]
        [MinLength(5), MaxLength(50)]
        [Display(Name = "Title", ResourceType = typeof(IM.Manage.Resources.News))]
        public string Title { get; set; }
        [MinLength(5), MaxLength(50)]
        [Display(Name = "SubTitle", ResourceType = typeof(IM.Manage.Resources.News))]
        public string SubTitle { get; set; }
        [MaxLength(20)]
        [Display(Name = "AuthorName", ResourceType = typeof(IM.Manage.Resources.News))]
        public string AuthorName { get; set; }
        [Display(Name = "Content", ResourceType = typeof(IM.Manage.Resources.News))]
        public string Content { get; set; }
        [Display(Name = "CreateTime", ResourceType = typeof(IM.Manage.Resources.News))]
        public DateTime CreateTime { get; set; }
        [Display(Name = "LastEditTime", ResourceType = typeof(IM.Manage.Resources.News))]
        public DateTime LastEditTime { get; set; }

        [Display(Name = "Category", ResourceType = typeof(IM.Manage.Resources.News))]
        public virtual NewsCategory Category { get; set; }
    }

    public class NewsCategory : BaseModel
    {
        [Display(Name = "CategoryName", ResourceType = typeof(IM.Manage.Resources.NewsCategory))]
        public string CategoryName { get; set; }
        [Display(Name = "Level", ResourceType = typeof(IM.Manage.Resources.NewsCategory))]
        public int Level { get; set; }

        [Display(Name = "MainCategory", ResourceType = typeof(IM.Manage.Resources.NewsCategory))]
        public virtual NewsCategory MainCategory { get; set; }
        [Display(Name = "SubCategory", ResourceType = typeof(IM.Manage.Resources.NewsCategory))]
        public virtual ICollection<NewsCategory> SubCategory { get; set; }
        [Display(Name = "NewsList", ResourceType = typeof(IM.Manage.Resources.NewsCategory))]
        public virtual ICollection<News> NewsList { get; set; }
    }
}